package prueba.prueba.helpers;

import prueba.prueba.TypeWords;

public class Word implements Comparable{

	private int id;
	public int getId() {
		return id;
	}

	public int getNumPractices() {
		return num_practices;
	}
	
	public int getNumHits() {
		return num_hits;
	}
	
	public String getWord() {
		return word;
	}

	public String getMeaning() {
		return meaning;
	}

	private String word;
	private String meaning;
	private int num_practices;
	private int num_hits;
	private TypeWords type;
	
	public Word(int id,String word,String meaning,int num_practices,int num_hits,TypeWords type){
		this.id = id;
		this.word = word;
		this.meaning = meaning;
		this.num_hits = num_hits;
		this.num_practices = num_practices;
		this.type = type;
	}

	public int compareTo(Object another) {
		
	    if(!(another instanceof Word)){
            throw new ClassCastException("Invalid object");
        }
       
	    Word another2 = ((Word) another);
        int num_hits = another2.num_hits;
        int num_practices = another2.num_practices;
        
        
        if (num_hits == this.num_hits && num_practices == this.num_practices)
        	return 0;
        
        else if (num_hits == this.num_hits){
        	
        	if (num_practices < this.num_practices)
        		return 1;
        	else return -1;
        
        	
        }
        else return num_hits < this.num_hits?1:-1;
	}
	
}
